package io.polly.ldz.reactor.config;

import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.TopicBuilder;

/**
 * @Author ldz112@163.com
 * @Classname KafkaConfig
 * @Version V1.0
 * @Description 创建定义topic
 * @Date 2024/9/29 22:12
 * Copyright (C) 2023 All Rights Reserved
 */
@Configuration
public class KafkaConfig {

    public final static String QUESTION_TOPIC = "sb_topic";
    @Bean
    public NewTopic newTopic(){
        return TopicBuilder.name(QUESTION_TOPIC) //主题名称
                .partitions(3) //分区数量
                .replicas(1) //副本数量
                .build();
    }
}
